package com.qingzhou.web.controller.common;

import com.qingzhou.common.enums.RateLimitType;
import com.qingzhou.framework.annotation.QzRateLimit;
import com.qingzhou.framework.service.CaptchaService;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Get;
import org.noear.solon.annotation.Inject;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.core.handle.Result;

import java.util.Map;

/**
 * 验证码 操作处理
 * @author xm
 */
@Controller
@Mapping("captcha")
public class CaptchaController {

    @Inject
    CaptchaService captchaService;

    /**
     * 获取验证码
     */
    @QzRateLimit(count = 5, type = RateLimitType.IP)
    @Get
    @Mapping
    public Result<Map<String, Object>> captcha() {
        return captchaService.getCaptcha();
    }

}
